package top.tupobi.zing.network;

public class BasicResponse<T> {

    public T result;
    private boolean success;
    private ResultError error;
    private String targetUrl;
    private boolean unAuthorizedRequest;
    private boolean __abp;

    public String getMsg() {
        if (null == error) {
            return "";
        } else if (null != error.details) {
            if (null != error.validationErrors) {
                return error.message + "\n" + error.details + "\n" + error.validationErrors;
            } else {
                return error.message + "\n" + error.details;
            }
        } else {
            return error.message;
        }
    }

    public T getResult() {
        return result;
    }

    public boolean isSuccess() {
        return success;
    }

    public class ResultError {
        public String code;
        public String message;
        public String details;
        public Object validationErrors;
    }
}